package com.app.util.pool;

import com.app.util.object.ObjectUtil;

public class PoolConfig<T> {

	private int maxActive = 200;// 最大活跃数
	private int maxIdle = 1800; // 最大空闲时间（S）
	private int checkTimes = 30; // 最大空闲检查时间（S）

	private NewObjectHandler<T> newObjectHandler;
	private CloseObjectHandler<T> closeObjectHandler;

	public PoolConfig(NewObjectHandler<T> newObjectHandler) {
		this.newObjectHandler = newObjectHandler;
	}

	public int getMaxActive() {
		return maxActive;
	}

	public void setMaxActive(int maxActive) {
		this.maxActive = maxActive;
	}

	public int getMaxIdle() {
		return maxIdle;
	}

	public void setMaxIdle(int maxIdle) {
		this.maxIdle = maxIdle;
	}

	public NewObjectHandler<T> getNewObjectHandler() {
		return newObjectHandler;
	}

	public void setNewObjectHandler(NewObjectHandler<T> newObjectHandler) {
		this.newObjectHandler = newObjectHandler;
	}

	public CloseObjectHandler<T> getCloseObjectHandler() {
		return closeObjectHandler;
	}

	public void setCloseObjectHandler(CloseObjectHandler<T> closeObjectHandler) {
		this.closeObjectHandler = closeObjectHandler;
	}

	public int getCheckTimes() {
		return checkTimes;
	}

	public void setCheckTimes(int checkTimes) {
		this.checkTimes = checkTimes;
	}

	@Override
	protected PoolConfig<T> clone() {
		PoolConfig<T> pc = new PoolConfig<T>(null);
		ObjectUtil.copyPropertyByNotNull(this, pc);
		return pc;
	}
}
